(function($){
   var loading='<div id="loading"></div>';
   var defaults={color:"yellow",text:"loading..."};
   $.loading=function(){
      if($("#loading").length==0)
      {
        $(document.body).append(loading);
        loading=$("#loading");
        loading.show=show;
        loading.hide=hide;
        loading.css("left",($(window).width()/2-loading.width()/2)+"px");  //display in center     
      }
      return loading;      
   }
   
   function show(opt)
   {
     opt=opt||defaults
     loading.css("background-color",opt.color)
     loading[0].innerHTML=opt.text;
     loading.css("display","block");
   }
   function hide()
   {   
     loading.css("display","none");
   }
})(jQuery);